//
//  ETH+Transaction.swift
//  XHWalletUtils
//
//  Created by xinph on 2020/5/16.
//  Copyright © 2020 xinph. All rights reserved.
//

import Foundation

extension ETH: TransactionProtocol {
    public func sendTransactionUnSigned(_ ts: TransactionConvertible, password: String, from: AddressConvertible) -> Observable<TransactionResult> {
        /// eth签名
        let ts = self.signTX(ts, password: password, from: from)
        /// doit
        return Observable<TransactionResult>.create {[weak self] o in
            /// 完善网络
            NetworkHelper.request(NetworkHelperService.sendTransation) {
                switch $0 {
                case .success(let rst) : print(rst)
                case .failure(let err): print(err)
                }
            }
            return Disposables.create()
        }
    }
}
